1. Field of the Invention
The present invention relates to a compile processing apparatus and method compiling a program formed of a plurality of classes each of which is provided with an initializing step. The present invention also relates to a storage medium storing a program causing a computer to execute a process in the above compile processing apparatus. Further, the present invention relates to a program executing apparatus and method executing a program formed of a plurality of classes each of which is provided with an initializing step and to a storage medium storing a program causing a computer to execute a process in the above program executing apparatus.
2. Description of the Related Art
In the resent years, programming for a computer system has been complex. The number of programs in which the initialization must be provided as the language specification is increased. Due to such programs, even if a programmer is not conscious to the initialization, the initialization process can be executed. As a result, the number of mistakes in a program can be decreased.
The initialization process may be executed once in the beginning. To ensure this condition, an execution speed of a program is lowered. Thus, it is necessary to improve the execution speed of such a type of program.
A program, such as an object oriented program, is formed of a plurality of classes in each of which data and procedure are encapsulated.
Such a class is used to execute data processing based on message communication. In the message communication, reference of data and access of procedure can be performed.
Further, the class has an initializing step which is named as a class-initializer. The class-initializer executes an initializing process once before the data is accessed in the beginning or before the procedure is accessed in the beginning.
To ensure activating the class-initializer only once, a conventional compiler inserts an IF-sentence for checking whether the class-initializer has been activated when a statement requiring the class-initializer is compiled. As a result, when it is determined, by the IF-sentence, that the class-initializer has been activated, a process is carried out so that the call-initializer is not accessed. On the other hand, when it is determined that the class-initializer has not yet been activated, the class-initializer is accessed and a flag indicating the activation of the class-initializer is activated in the class provided with the class-initializer.
In addition, there is another programming technology in which the format of the program is changed to that having no class-initializer while the program is being executed. Due to such a programming technology, activating the class-initializer only once is ensured.
However, according to the former technology in which activating the class-initializer only once is ensured by insertion of the IF-sentence, if the class-initializer is accessed a large number of times, the execution speed of the program is lowered since the IF-sentence is checked every time the class-initializer is accessed.
The latter technology in which the format of the program is changed to that having no class-initializer while the program is being executed to ensure activating the class-initializer only once is useful for a case, such as a case of an interpreter, where an interpreting process and a process are simultaneously executed. However, in a case where the interpreting process and a process are separately executed, a system for changing the format of the program is needed to provided in the program and the execution speed of the program is lowered by the execution of the system.